package com.lluohao.common;

import com.lluohao.web.controller.MessageVO;
import com.lluohao.web.controller.Result;
import java.util.ArrayList;
import java.util.List;

public class ListMessageHandler implements MessageHandler{
    private List<MessageHandler> handlers = new ArrayList<MessageHandler>();
    public Result handler(MessageVO message) {
        Result result = null;
        for (MessageHandler handler : handlers) {
            result = handler.handler(message);
            if(message!=null){
                return result;
            }
        }
        return null;
    }
    public void addHandler(MessageHandler handler){
        this.handlers.add(handler);
    }
}
